package com.atguigu.edu.publisher.mapper;

import com.atguigu.edu.publisher.beans.TrafficChViewDate;
import com.atguigu.edu.publisher.beans.TrafficKeyWordDate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TrafficStatsMapper {


    @Select("SELECT scName , sum(uv_ct) uv_ct , SUM(sv_ct) sv_ct , SUM(pv_ct)/SUM(sv_ct) avg_pv , sum(dur_sum)/SUM(sv_ct) avg_dul\n" +
            "from dws_traffic_sc_is_new_page_view_window\n" +
            "PARTITION par${date} GROUP BY scName\n" +
            "\n")
    List<TrafficChViewDate> selectChViewDate(@Param("date") String date);

    @Select("SELECT key_word , sum(word_sum) word_sum " +
            "from dws_traffic_keyword_view_window PARTITION par${date} GROUP BY key_word\n")
    List<TrafficKeyWordDate> selectKeyWordDate(@Param("date") String date);
}
